<h1 style="color:#FF3300;margin-bottom:10px">Car Manager</h1>
<select id="drdprovide" onchange="location.assign('<?php echo base_url(); ?>admin/car/index?provide='+$('#drdprovide').val());">
  <option value="0" <?php if(isset($_GET['provide'])){ if($_GET['provide']=="0") echo "selected";}?>>Choose Provide</option>
  <option value="bagan" <?php if(isset($_GET['provide'])){ if($_GET['provide']=="bagan") echo "selected";}?>>Bagan</option>
  <option value="inle" <?php if(isset($_GET['provide'])){ if($_GET['provide']=="inle") echo "selected";}?>>Inle</option>
  <option value="mandalay" <?php if(isset($_GET['provide'])){ if($_GET['provide']=="mandalay") echo "selected";}?>>Mandalay</option>
  <option value="yangon" <?php if(isset($_GET['provide'])){ if($_GET['provide']=="yangon") echo "selected";}?>>Yangon</option>
</select>
<input type="text" id="searchname" value="" placeholder="Name..."/>
<?php
				$car_name="";
				for($i=0;$i<count($data);$i++){
					if($i!=(count($data)-1)) $car_name.= '"'.$data[$i]['name'].'",';
					else $car_name.= '"'.$data[$i]['name'].'"';			
			}?>
<script>
				$(function() {
					var car_name = [
					<?php echo $car_name; ?>
					];
					$("#searchname").autocomplete({
					source: car_name
					});
				});
          </script>
<input type="button" value=" " style="border:1px solid #d5d5d5;cursor:pointer;background:url(<?php echo base_url() ?>public/images/iconsearch_submit.png) no-repeat center center #143167; padding:0 5px" id="btnsearch">
<script>
	$('#searchname').click(function(){
		$('#searchname').removeClass('bxshadow_ff0000');								
	});
	$('#btnsearch').click(function(){
		if($('#searchname').val()==''){
			$('#searchname').addClass('bxshadow_ff0000');			
			return false;
		}else 
			<?php if(isset($_GET['provide'])){?>
				location.assign('<?php echo base_url(); ?>admin/car/index?provide=<?php echo $_GET['provide'] ?>&name='+$('#searchname').val());
			<?php }else{?>
				location.assign('<?php echo base_url(); ?>admin/car/index?provide=0&name='+$('#searchname').val());
			<?php }?>
	})
</script>
<input type="button" onclick="location.assign('<?php echo base_url(); ?>admin/car/edit');" value="Insert" style="float:right;margin-right:10px;margin-bottom:5px;"/>
<table cellpadding="0" cellspacing="0">
  <tr>
    <th>STT</th>
    <th>Name</th>
    <!--<th>Address</th>-->
    <th>Price</th>
    <!--<th>Category</th>-->
    <th>Provide</th>
    <th>Pick Up</th>
    <th>Drop Off</th>
    <th>Status</th>
    <th>Edit / Del</th>
    <th>Banner</th>
  </tr>
  <?php if(count($data)>0){ foreach($data as $k=>$list){?>
  <tr>
    <th><?php echo $k+1; ?></th>
    <td><?php echo $list["name"]; ?></td>
    <!--<td><?php echo $list["address"]; ?></td>-->
    <td><?php echo "$".$list["price"]; ?></td>
    <!--<td><?php echo $list["category"]; ?></td>-->
    <td><?php echo $list["provide"]; ?></td>
    <td><?php echo $list["pickup"]; ?></td>
    <td><?php echo $list["dropoff"]; ?></td>
    <th><select name="changestatus" onChange="location.assign('<?php echo base_url(); ?>/admin/car/changestatus?id=<?php echo $list["id"] ?>&status='+this.options[this.selectedIndex].value);">
        <option value="1" <?php if($list['status']==1) echo "selected";?>>Highlights</option>
        <option value="2" <?php if($list['status']==2) echo "selected";?>>Normal</option>
        <option value="3" <?php if($list['status']==3) echo "selected";?>>Hidden</option>
      </select></th>
    <th><a href="<?php echo base_url(); ?>admin/car/edit?id=<?php echo $list['id'] ?>"><img src="<?php echo base_url(); ?>public/admin/img/icons/user_edit.png"/></a> <a href="javascript:void(0);" onClick="if(confirm('Do you want to Del this Information ?')) location.assign('<?php echo base_url(); ?>admin/car/delete?id=<?php echo $list["id"]; ?>');"><img src="<?php echo base_url(); ?>public/admin/img/icons/user_delete.png"/></a></th>
    <th><a href="<?php echo base_url(); ?>admin/carbanner/index?carid=<?php echo $list['id'] ?>">Banner</a></th>
  </tr>
  <?php }}?>
</table>
